package com.company.finance.ddd.domain.core.bill.repository;

import com.company.finance.ddd.common.IRepository;
import com.company.finance.ddd.domain.core.bill.aggregate.PayItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class PayItemRepository implements IRepository<PayItem> {
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    
    @Override
    public void save(PayItem entity) {
        
    }

    @Override
    public List<PayItem> query(Map<String, Object> queryCondition) {
        return jdbcTemplate.query("select * from bill_item_pay where bill_id = ?"
                , queryCondition.values().toArray(), new BeanPropertyRowMapper<>(PayItem.class));
    }

    @Override
    public PayItem get(Long id) {
        return null;
    }

    @Override
    public void delete(Long billId) {
        throw new UnsupportedOperationException();
    }
}
